package com.souku.finance.application.ui.mine;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.souku.finance.application.R;
import com.souku.finance.application.base.BaseActivity;
import com.souku.finance.application.utils.Constant;
import com.souku.finance.application.utils.MyTextUtil;
import com.souku.finance.application.widget.MyTextView;

/**
 * Created by Android on 2016/12/23.
 */

public class BalanceActivity extends BaseActivity implements View.OnClickListener {

    protected RelativeLayout topBack;
    protected TextView topTitle;
    protected TextView topTvMore;
    protected Button btnRecharge;
    protected Button btnWithdraw;
    protected MyTextView tvMoney;
    private String money;

    @Override
    public void internet() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.act_balance);
        initView();
        money = getIntent().getStringExtra(Constant.Default);
        if (!MyTextUtil.isEmpty(money)) {
            tvMoney.setText(MyTextUtil.setMoneyToElement(money));
        }
        topTitle.setText("余额");
        topTvMore.setVisibility(View.VISIBLE);
        topTvMore.setText("明细");
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.top_back) {
            finish();
        } else if (view.getId() == R.id.top_tv_more) {
            Intent intent = new Intent(this, BalanceDetailedActivity.class);
            startActivity(intent);
        } else if (view.getId() == R.id.btn_recharge) {
            Intent intent = new Intent(this, RechargrActivity.class);
            startActivity(intent);
        } else if (view.getId() == R.id.btn_withdraw) {
            Intent intent = new Intent(this, WithDrawActivity.class);
            startActivity(intent);
        }
    }

    private void initView() {
        topBack = (RelativeLayout) findViewById(R.id.top_back);
        topBack.setOnClickListener(BalanceActivity.this);
        topTitle = (TextView) findViewById(R.id.top_title);
        topTvMore = (TextView) findViewById(R.id.top_tv_more);
        topTvMore.setOnClickListener(BalanceActivity.this);
        btnRecharge = (Button) findViewById(R.id.btn_recharge);
        btnRecharge.setOnClickListener(BalanceActivity.this);
        btnWithdraw = (Button) findViewById(R.id.btn_withdraw);
        btnWithdraw.setOnClickListener(BalanceActivity.this);
        tvMoney = (MyTextView) findViewById(R.id.tv_money);
    }
}
